package com.wc.AlgoOJ_train.train1.c0.A018;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/25 11:22
 * @description 手机短号
 * http://43.138.190.70:8888/p/A018
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxN = (int) 1e5;
        while (n-- > 0) {
            long number = sc.nextLong();
            number %= maxN;
            number += 6 * maxN;
            System.out.println(number);
        }
    }
}
